﻿
@{
    ViewBag.Title = "QueFpList";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<style>
   .table-responsive{
        border:0;
    }
</style>

<!--发票列表-->
<form id="tabGrid" style="margin:2px;margin-top:10px;">
    <div class="gridPanel">
        <table id="gridListFPH" rel="tabGrid"></table>
    </div>
</form>

<script> 
     
    $(function () {
        var fapiaodata = localStorage.getItem("fapiaodata");
        gridListFPH(JSON.parse(fapiaodata));
    });

    //加载发票列表
    function gridListFPH(mydata) {
        var $gridList = $("#gridListFPH");
        $gridList.dataNewGrid({
            height: 500, 
            caption: "发票列表",
            colModel: [
                { label: 'jsnm', name: 'jsnm', hidden: true },
                { label: 'flzffy', name: 'flzffy', hidden: true },
                { label: 'zffy', name: 'zffy', hidden: true },
                { label: 'jzfy', name: 'jzfy', hidden: true },
                { label: 'zlfy', name: 'zlfy', hidden: true },
                { label: 'xjzf', name: 'xjzf', hidden: true },
                { label: '姓名', name: 'xm', width: 100, align: 'left' },
                { label: '卡号', name: 'kh', width: 100, align: 'left' },
                { label: '发票号', name: 'fph', width: 100, align: 'left' },
                {
                    label: '结算日期', name: 'CreateTime', width: 100, align: 'left', formatter: function (cellvalue) {
                        return cellvalue && cellvalue.length >= 10 ? cellvalue.substring(0, 10) : ""
                    }
                },
                { label: '总金额', name: 'zje', width: 100, align: 'left' }
            ]
        }, mydata);
        if (mydata.length > 0) {
            $('.ui-jqgrid-bdiv').find(".unwritten").remove();
        }
    }

 

    //发票列表单击事件 
    function btn_edit() {
        var data = $("#gridListFPH").jqGridRowValue();
        if (data) {
            //input控件取消了，放在td中
            $.currentWindow().loadFpData(data); //主页中的方法
            PatSearchConfirm();
          
        } else {
            $.modalAlert("当前无选中的发票！", "warning");
        }

    }

    //确定 主页面调用
    function PatSearchConfirm() {
        var $gridList = $("#gridListFPH");
        var kh = $gridList.jqGridRowValue().kh;
        var zyh = $gridList.jqGridRowValue().zyh;
        var xm = $gridList.jqGridRowValue().xm;
        var obj = new Object();
        obj.kh = kh;
        obj.zyh = zyh;
        obj.xm = xm; 
        //关闭窗口
        ReceiptCancle();
    }

    //取消
    function ReceiptCancle() {
        $.modalClose();
    }
</script>

